package com.intelligencesoft.pss.enums;


public enum BindingType {
	BINDING_SINA_WEIBO("新浪微博",0),
	BINDING_TENCENT_WEIBO("腾讯微博",1),
	BINDING_MICROMSG("微信",2);
	
	private String label;
	private int value;
	
	private BindingType(String label,int value) {
		this.label = label;
		this.value = value;
	}
	
	public String getLabel() {
		return label;
	}
	public void setLabel(String label) {
		this.label = label;
	}
	public int getValue() {
		return value;
	}
	public void setValue(int value) {
		this.value = value;
	}
	
	public static String getLabel(int value){
		for (BindingType materType : BindingType.values()) {
			if(materType.getValue() == value){
				return materType.label;
			}
		}
		return null;
	}
	
	public static String getLabel(String name){
		for (BindingType materType : BindingType.values()) {
			if(materType.name() == name){
				return materType.label;
			}
		}
		return null;
	}
	
	public static int parseValue(String name){
		for (BindingType materType : BindingType.values()) {
			if(materType.name() == name){
				return materType.value;
			}
		}
		return -1;
	}
	
}
